home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
CC_C
/
0574.ZIP
/
FSEEK.ASM
< prev
next >
Wrap
Assembly Source File
|
1986-11-20
|
791b
|
34 lines
include compiler.inc
ttl FSEEK, 1.05, 10/20/86, jwk
;lseek for stream i/o- long lseek(handle, offsetL, base);
; returns file position, or -1L in case of error
; clears any ungetc() char, CR flag, and EOF flag
dseg
exterr
cseg
xtfs <lseek,$strhand>
procdef fseek, <<stream, ptr>, <offlo, word>, <offhi, word>, <base, byte>>
pushreg
pushds
callit $strhand <<stream,ptr>>
cmp ax,-1
je ex ; bad stream pointer
callit lseek,<<base,byte>,<offhi,word>,<offlo,word>,<ax,reg>>
ldptr si,stream
mov word ptr [si], -1 ; blank out UGC char if any
and byte ptr 2[si], 0f7h ; clear EOF bit
mov byte ptr 3[si], 0 ; and CRFLG
inc dx
jnz ex
saverr ; save error code
or byte ptr 2[si],10h ; set error flag bit
ex: dec dx
pret
pend fseek
finish